{template 'common/header'}

<ul class="nav nav-tabs">
	<li{if $op == 'display'} class="active"{/if}><a href="{php echo $this->createWebUrl('category',array('op' => 'display'))}">类目管理</a></li>
	<li{if $op == 'post'} class="active"{/if}><a href="{php echo $this->createWebUrl('category',array('op' => 'post') )}">添加类目</a></li>
</ul>

{if $op == 'post'}
	<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data">
		<input type="hidden" name="token" value="{$_W['token']}" />
		<div class="form-group">
			<label for="inputEmail3" class="col-sm-2 control-label">标题</label>
			<div class="col-sm-4">
			  <input type="text" name="cname" value="{$item['name']}" class="form-control" placeHolder="请输入分类名称">
			</div>
		</div>
	
		<div class="form-group">
			<label for="inputPassword3" class="col-sm-2 control-label">父级栏目</label>
			<div class="col-sm-4">
				<select class="form-control" name="parentid">
					<option value="0">作为父级栏目</option>
					{loop $categorys $p}
						<option value="{$p['id']}" {if $item['parentid'] == $p['id']}selected="selected"{/if}>{$p['name']}</option>
					{/loop}
				</select>
				<div class="alert alert-info" role="alert" style="margin-top:5px">只支持二级分类</div>
			</div>
		</div>
	  
		<div class="form-group">
		  <div class="col-sm-offset-2 col-sm-10">
		    <div class="checkbox">
		      <label>
		      	<input type="checkbox" name="enabled" {if intval($item['enabled'])==1}checked='checked'{/if}> 是否显示
		      </label>
		    </div>
		  </div>
		</div>
	  
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-primary">提交</button>
			</div>
		</div>
	  
	</form>

{elseif $op == 'display'}

<form action="" method="post" onsubmit="">
<div style="padding:15px;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th>选择</th>
					<th>名称</th>
					<th>父栏目</th>
					<th>是否开启</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{$o}
			</tbody>
		</table>
		<table class="table">
			<tr>
				<td class="span1">
					<input type="submit" name="delete" value="删除" class="btn btn-primary" />		
					<input type="hidden" name="token" value="{$_W['token']}" />		
				</td>
			</tr>
		</table>
		{$pager}
	</div>
</form>
{/if}
{template 'common/footer'}